package cn.liujianbo.example.pattern.chain_of_responsibility;

import lombok.Getter;
import lombok.Setter;

/**
 * @author 刘建波
 * @date 2022-01-18 22:58
 */
@Getter
@Setter
public abstract class AbstractHandler  {
    private AbstractHandler nextHandler;

    public void filter() {
        System.out.println(this.getClass().getName() + "filter 前");
        doFilter();
        if (nextHandler != null) {
            nextHandler.filter();
        }
        System.out.println(this.getClass().getName() + "filter 后");
    }

    public abstract void doFilter();

}
